<?php
/**
 * Protoweb's base controller with base functionality
 */
include_once 'pwcontroller.php';

/**
 * To validate some things about users and projects
 */
include_once 'projects.php';

/**
 * The controller attribute model
 *
 * Public controller methods are friendly urls thanks to {@link http://codeigniter.com
 * Codeigniter}.
 *
 * @author Gonzalez Federico, Viera Leonel
 * @package Protoweb
 * @subpackage controller
 */
class Attributes extends PwController
{
    public function __construct()
    {
        parent::__construct();
    } 

    /**
     * Used with AJAX. Returns an HTML string that will be show on screen
     * 
     * @param integer $attr_id ID of the attribute to get 
     */
    public function get_attribute($attr_id=0)
    {
        $data['purposes']  = Purpose::getAll();
        $data['attribute'] = new Attribute($attr_id);
        $data['rules']     = new Rule();
        $data['rules']->get()->all;
        
        if ( ! $attr_id) {
            $data['attribute']->name = 'New Attribute';
        }

        $this->smartyview->smarty->assign($data);
        die($this->smartyview->smarty->fetch('attribute_create.html'));
    }
}// class Attributes

/* End of file attributes.php */
/* Location: ./application/controllers/attributes.php */
